home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / relay / article.c < prev    next >
C/C++ Source or Header  |  1989-06-27  |  1KB  |  53 lines

  1. /*
  2.  * article creation and destruction
  3.  */
  4. #include <stdio.h>
  5. #include <sys/types.h>
  6. #include "libc.h"
  7. #include "news.h"
  8. #include "headers.h"
  9. #include "article.h"
  10.  
  11. void
  12. artinit(art)
  13. register struct article *art;
  14. {
  15.     art->a_status = ST_OKAY;
  16.     hdrinit(&art->h);
  17.     art->a_haccum = NULL;
  18.     art->a_hnext = NULL;
  19.     art->a_hpalloced = 0;
  20.     art->a_hpused = 0;
  21.     art->a_hptrs = NULL;
  22.     art->a_hbytesleft = 0;
  23.     art->a_files = NULL;
  24.     art->a_tmpf = NULL;
  25.     art->a_artf = NULL;
  26.     art->a_unlink = NO;
  27.     art->a_filed = NO;
  28.     art->a_xref = NO;
  29.     art->a_blvmax = NO;
  30.     art->a_charswritten = 0;
  31.     art->a_unread = 0;
  32. }
  33.  
  34. void
  35. artfree(art)
  36. register struct article *art;
  37. {
  38.     freeheaders(&art->h);
  39.     /* a_haccum is currently not malloced */
  40.     art->a_hptrs = NULL;        /* don't free a_hptrs; see hdrsave() */
  41.     nnfree(&art->a_files);
  42.     nnfree(&art->a_tmpf);
  43.     if (art->a_artf != NULL) {
  44.         (void) fprintf(stderr, "%s: a_artf still open in artfree()\n",
  45.             progname);
  46.         if (nfclose(art->a_artf) == EOF) {
  47.             art->a_status |= ST_DROPPED;
  48.             warning("error closing %s", art->a_tmpf);
  49.         }
  50.         art->a_artf = NULL;
  51.     }
  52. }
  53.